package vip.specimen.system.datasource.entity;

import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
import vip.specimen.system.common.enums.SaveMethodEnum;

import javax.persistence.*;

@Getter
@Setter
@Entity
@Table(name = "system_save_config")
public class SystemSaveConfigEntity extends BaseEntity {
    @ApiModelProperty(value = "存储方式", dataType = "SaveMethodEnum")
    @Enumerated(EnumType.STRING)
    private SaveMethodEnum saveMethod; // 保存方式
    @ApiModelProperty(value = "七牛云空间名称")
    private String qiNiuSaveName;// 空间名称
    @ApiModelProperty(value = "七牛云访问域名")
    private String qiNiuDomain; // 访问域名
    @Column(length = 64)
    @ApiModelProperty(value = "七牛云AccessKey")
    private String qiNiuAccessKey;
    @Column(length = 64)
    @ApiModelProperty(value = "七牛云SecretKey")
    private String qiNiuSecretKey;
    @ApiModelProperty(value = "OSS访问域名")
    private String aliEndpoint;
    @ApiModelProperty(value = "OSS AccessKey")
    private String aliAccessKey;
    @ApiModelProperty(value = "OSS AccessKeySecret")
    private String aliAccessKeySecret;
    @ApiModelProperty(value = "OSS BucketName")
    private String aliBucketName;
    @ApiModelProperty(value = "是否启用解析[CNAME选项]")
    private boolean aliSupportCname = false;
    @ApiModelProperty(value = "Tencent SecretId")
    private String tencentSecretId;
    @ApiModelProperty(value = "Tencent SecretKey")
    private String tencentSecretKey;
    @ApiModelProperty(value = "Tencent BucketName")
    private String tencentBucketName;
    @ApiModelProperty(value = "Tencent 所属地域")
    private String tencentRegion;
    @ApiModelProperty(value = "Tencent 访问域名")
    private String tencentDomain;


    public SystemSaveConfigEntity() {
    }

    /**
     * 七牛
     *
     * @param saveMethod     `
     * @param qiNiuSaveName  `
     * @param qiNiuDomain    `
     * @param qiNiuAccessKey `
     * @param qiNiuSecretKey `
     */
    public SystemSaveConfigEntity(SaveMethodEnum saveMethod, String qiNiuSaveName, String qiNiuDomain, String qiNiuAccessKey, String qiNiuSecretKey) {
        this.saveMethod = saveMethod;
        this.qiNiuSaveName = qiNiuSaveName;
        this.qiNiuDomain = qiNiuDomain;
        this.qiNiuAccessKey = qiNiuAccessKey;
        this.qiNiuSecretKey = qiNiuSecretKey;
    }

    /**
     * 阿里OSS
     *
     * @param saveMethod         `
     * @param aliEndpoint        `
     * @param aliAccessKey       `
     * @param aliAccessKeySecret `
     * @param aliBucketName      `
     * @param aliSupportCname    `
     */
    public SystemSaveConfigEntity(SaveMethodEnum saveMethod, String aliEndpoint, String aliAccessKey, String aliAccessKeySecret, String aliBucketName, boolean aliSupportCname) {
        this.saveMethod = saveMethod;
        this.aliEndpoint = aliEndpoint;
        this.aliAccessKey = aliAccessKey;
        this.aliAccessKeySecret = aliAccessKeySecret;
        this.aliBucketName = aliBucketName;
        this.aliSupportCname = aliSupportCname;
    }

    /**
     * 腾讯云
     *
     * @param saveMethod        `
     * @param tencentSecretId   `
     * @param tencentSecretKey  `
     * @param tencentBucketName `
     * @param tencentRegion     `
     * @param tencentDomain     `
     */
    public SystemSaveConfigEntity(SaveMethodEnum saveMethod, String tencentSecretId, String tencentSecretKey, String tencentBucketName, String tencentRegion, String tencentDomain) {
        this.saveMethod = saveMethod;
        this.tencentSecretId = tencentSecretId;
        this.tencentSecretKey = tencentSecretKey;
        this.tencentBucketName = tencentBucketName;
        this.tencentRegion = tencentRegion;
        this.tencentDomain = tencentDomain;
    }
}
